﻿@model Yala.Client.Web.MVC.Models.ToDoItemsModel


@{
    ViewBag.Title = "ToDoItem";
}


<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>

<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery(".expander-content").hide();
        //toggle the componenet with class msg_body
        jQuery(".expander-heading").click(function () {
            jQuery(this).next(".expander-content").slideToggle(500);
        });
    });
</script>

<div id="submenucontainer" align="left">
    <ul id="submenu">
        <li>@Html.ActionLink("ToDo List", "Index", "ToDoList")</li>
    </ul>
</div>

<p align="right">
    @Html.ActionLink("Create New", "Create")
</p>

<div class="container showgrid">
    <hr/>
    <div class="span-2 border">Rank</div>
    <div class="span-2 border">Name</div>
    <div class="span-7 border">Description</div>
    <div class="span-2 border">Status</div>
    <div class="span-3 border">Created Date</div>
    <div class="span-2 border">Start Date</div>
    <div class="span-2 border">End Date</div>
    <div class="span-3 last">Action</div>
    <hr/>
    <div class="expander-layer">

	     @{
             var categoryGroups = from item in Model.ToDoItems group item by item.Category;
             foreach (var categoryGroup in categoryGroups)
             {
                 <p class="expander-heading">@categoryGroup.Key</p>                                 
                 <div class="expander-content">
                 <div class="container showgrid">
                 @foreach (var item in categoryGroup)
                 {
                    <div class="span-2 border">1</div>
                    <div class="span-2 border">@item.ItemName</div>
                    <div class="span-7 border">@item.Description</div>
                    <div class="span-2 border">@item.Status</div>
                    <div class="span-3 border">@item.CreatedDate.ToShortDateString()</div>
                    <div class="span-2 border">@item.StartTime.ToShortDateString()</div>
                    <div class="span-2 border">@item.StartTime.ToShortDateString()</div>
                    <div class="span-3 last">
                        @Html.ActionLink("View", "View", new { /* id=item.PrimaryKey */ }) |
                        @Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
                        @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
                    </div>
                    <hr/>
                 }
                 </div>
                 </div>
             }

         }
    </div>

</div>

